<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Lists extends AmisBasics
{
    public string $type = 'list';

    public function title(string $title)
    {
        $this->title = $title;
        return $this;
    }

    /**
     * 数据源, 获取当前数据域变量，支持数据映射
     * @param string $source
     * @return $this
     */
    public function source(string $source)
    {
        $this->source = $source;
        return $this;
    }

    /**
     * ‘暂无数据’
     * @param string $placeholder
     * @return $this
     */
    public function placeholder(string $placeholder)
    {
        $this->placeholder = $placeholder;
        return $this;
    }

    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 顶部外层 CSS 类名
     * @param string $headerClassName
     * @return $this
     */
    public function headerClassName(string $headerClassName = 'amis-list-header')
    {
        $this->headerClassName = $headerClassName;
        return $this;
    }

    /**
     * 底部外层 CSS 类名
     * @param string $footerClassName
     * @return $this
     */
    public function footerClassName(string $footerClassName = 'amis-list-footer')
    {
        $this->footerClassName = $footerClassName;
        return $this;
    }

    /**
     * 配置单条信息
     * @param \Amis\dataviewer\ListsItem ...$listItem
     * @return $this
     */
    public function listItem(ListsItem ...$listItem)
    {
        $this->set(__FUNCTION__,...$listItem);
        return $this;
    }
}